<?php
/**
 * @link https://www.kancloud.cn/cleverstone/ymb2
 * @copyright Copyright (c) 2020 Yii Manager Software LLC
 */

/** @var \yii\web\View $this */
/** @var \builder\lists\ListsBuilder $context 当前列表组件实例 */
/** @var array $rootLayout 根布局 */
/** @var array $listLayout 列布局 */
/** @var array $listRows 列表行数据 */

$context = $this->context;
?>

<div id="__YM2_BUILDER_ID__<?= $context->id ?>" class="layui-card mb-0 shadow-none <?= $rootLayout['class'] ?>" style="<?= $rootLayout['style'] ?>" ng-controller="ym2.ctrl.<?= $context->id ?>"<?= $rootLayout['attribute'] ?>>
    <div class="layui-card-body px-4 pb-0">
        <!--页面开始-->
        <?= $context->beginPage() ?>

        <!--数据列表-->
        <table class="builder-lists-table layui-table ym2-table-gray <?= $listLayout['class'] ?>" style="<?= $listLayout['style'] ?>"<?= $listLayout['attribute'] ?>>
            <tbody>
<?php foreach ($listRows as $label => $options): ?>
<?php if (is_int($label) && is_array(array_values($options)[0])): ?>
                <tr>
<?php foreach ($options as $linkLabel => $linkOptions): ?>
                    <th class="<?= $linkOptions['thClass'] ?>" style="<?= $linkOptions['thStyle'] ?>"<?= $linkOptions['thAttribute'] ?>>
                        <?= $linkLabel ?>
                    </th>
<?php if ($linkOptions['content'] !== false): ?>
                    <td class="<?= $linkOptions['tdClass'] ?>" style="<?= $linkOptions['tdStyle'] ?>"<?= $linkOptions['tdAttribute'] ?>>
                        <?= $linkOptions['content'] ?>
                    </td>
<?php endif; ?>
<?php endforeach; ?>
                </tr>
<?php else: ?>
                <tr>
<?php if (!is_int($label)): ?>
                    <th class="<?= $options['thClass'] ?>" style="<?= $options['thStyle'] ?>"<?= $options['thAttribute'] ?>>
                        <?= $label ?>
                    </th>
<?php endif; ?>
<?php if ($options['content'] !== false): ?>
                    <td class="<?= $options['tdClass'] ?>" style="<?= $options['tdStyle'] ?>"<?= $options['tdAttribute'] ?>>
                        <?= $options['content'] ?>
                    </td>
<?php endif; ?>
                </tr>
<?php endif; ?>
<?php endforeach; ?>
            </tbody>
        </table>

        <!--页面结束-->
        <?= $context->endPage() ?>
    </div>
</div>
